<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="x-theme-draft">

 
 <%@ include file="/WEB-INF/include/header.jsp"%>
 <%@ include file="/WEB-INF/include/submenu.jsp"%>

 <div class="container-fluid x-container has-x-sidemenu">

  <ol class="x-breadcrumb breadcrumb">
   <li class="active">赌局管理&nbsp;-&nbsp;赌局列表</li>
  </ol>

  <div class="x-content-layout">
   <div class="x-operation-bar no-margin no-bottom-border clearfix">


   <div class="x-operation-bar no-margin no-bottom-border clearfix">
     <div class="x-operation-group pull-right">
     <!-- <a href="${ctx.host}/agents/search" data-target="#search" data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;筛选
      </a>-->
      
      <a href="${ctx.host}/bets/create" data-target="#create" data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;新增

      </a>
     <!-- <a href="${ctx.host}/bets/create" data-toggle="modal" data-target="#create">新增</a>&nbsp;&nbsp;-->
     </div>
    </div>

    <table class="table table-hover x-table">
     <thead>
      <tr>
       <th>赌局名称</th>
       <th>有效期</th>
       <th>奖金池</th>
       <th>参与人数</th>
       <th class="text-center">操作</th>
      </tr>
     </thead>
     <tbody>
      <c:forEach var="bets" items="${bets}" varStatus="status">
       <tr>
       	<td>${bets.name}</td>
       	<td>	
       		<fmt:formatDate value="${bets.startDate}" pattern="yyyy-MM-dd" /><br />
       		<fmt:formatDate value="${bets.endDate}" pattern="yyyy-MM-dd" /></td>
       	<td>${bets.betBonus}</td>
       	<td>${bets.thumbAmount}</td>
       	<td class="text-center">
       		<c:choose>
       			<c:when test="${bets.status == 'CREATED'}">
       			  <a href="${ctx.host}/bets/${bets.id}/open" data-toggle="modal" data-target="#open">开启</a>&nbsp;&nbsp;
                  <a href="${ctx.host}/bets/${bets.id}/edit-cover" data-toggle="modal" data-target="#edit-cover">编辑封面</a>&nbsp;&nbsp;
       			  <a href="${ctx.host}/bets/${bets.id}">详情</a>
       			</c:when>
       			<c:when test="${bets.status == 'PROCESSING'}">
       				<a href="${ctx.host}/bets/${bets.id}/close" data-toggle="modal" data-target="#close">关闭</a>&nbsp;&nbsp;
       				<a href="${ctx.host}/bets/${bets.id}">详情</a>
       			</c:when>
                
       			<c:when test="${bets.status == 'FINISHED'}">
       				<a href="${ctx.host}/bets/${bets.id}">详情</a>
       			</c:when>
       		</c:choose>
       	</td>
       </tr>
      </c:forEach>
     </tbody>
     <tfoot>
      <tr>
       <td colspan="8" class="no-vertical-padding">
        <div class="pull-left">
         <jsp:include page="/WEB-INF/include/page.jsp">
          <jsp:param name="url" value="${ctx.host}/bets" />
          <jsp:param name="queryString" value="${queryString}" />
         </jsp:include>
        </div>
       </td>
      </tr>
     </tfoot>
    </table>
   </div>
  </div>
 </div>
 <%@ include file="/WEB-INF/include/footer.jsp"%>
 <%@ include file="/WEB-INF/include/script.jsp"%>
<d:resource root="${ctx.resource}/build" type="script" src="js/page/bet/bet-list.js" />
 <script type="text/javascript">
        require([ 'page/bet/bet-list' ], function(page) {
            page.init();
        })
    </script>
</body>
</html>